Optimal. Leaf size=46 \[ \frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac {a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.17, antiderivative size = 70, normalized size of antiderivative = 1.52, number of steps used = 8, number of rules used = 8, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.296, Rules used = {2911, 3767, 8, 3201, 446, 78, 63, 206} \[ \frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac {a^2 \sqrt {\cos ^2(c+d x)} \sec (c+d x) \tanh ^{-1}\left (\sqrt {\cos ^2(c+d x)}\right )}{d}+\frac {2 a b \tan (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 63
Rule 78
Rule 206
Rule 446
Rule 2911
Rule 3201
Rule 3767
Rubi steps
\begin {align*} \int \csc (c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=(2 a b) \int \sec ^2(c+d x) \, dx+\int \csc (c+d x) \sec ^2(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \, dx\\ &=-\frac {(2 a b) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}+\frac {\left (\sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {a^2+b^2 x^2}{x \left (1-x^2\right )^{3/2}} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {2 a b \tan (c+d x)}{d}+\frac {\left (\sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {a^2+b^2 x}{(1-x)^{3/2} x} \, dx,x,\sin ^2(c+d x)\right )}{2 d}\\ &=\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {2 a b \tan (c+d x)}{d}+\frac {\left (a^2 \sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {1-x} x} \, dx,x,\sin ^2(c+d x)\right )}{2 d}\\ &=\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {2 a b \tan (c+d x)}{d}-\frac {\left (a^2 \sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sqrt {\cos ^2(c+d x)}\right )}{d}\\ &=\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac {a^2 \tanh ^{-1}\left (\sqrt {\cos ^2(c+d x)}\right ) \sqrt {\cos ^2(c+d x)} \sec (c+d x)}{d}+\frac {2 a b \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.20, size = 58, normalized size = 1.26 \[ \frac {\left (a^2+b^2\right ) \sec (c+d x)+a \left (a \left (\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )\right )+2 b \tan (c+d x)\right )}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.45, size = 77, normalized size = 1.67 \[ -\frac {a^{2} \cos \left (d x + c\right ) \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - a^{2} \cos \left (d x + c\right ) \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 4 \, a b \sin \left (d x + c\right ) - 2 \, a^{2} - 2 \, b^{2}}{2 \, d \cos \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.21, size = 57, normalized size = 1.24 \[ \frac {a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - \frac {2 \, {\left (2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2} + b^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.55, size = 68, normalized size = 1.48 \[ \frac {a^{2}}{d \cos \left (d x +c \right )}+\frac {a^{2} \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}+\frac {2 a b \tan \left (d x +c \right )}{d}+\frac {b^{2}}{d \cos \left (d x +c \right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.36, size = 64, normalized size = 1.39 \[ \frac {a^{2} {\left (\frac {2}{\cos \left (d x + c\right )} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + 4 \, a b \tan \left (d x + c\right ) + \frac {2 \, b^{2}}{\cos \left (d x + c\right )}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 11.85, size = 62, normalized size = 1.35 \[ \frac {a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {2\,a^2+4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+2\,b^2}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________